<?php
session_start();
include('database.php');

$password=md5($_POST[password_login]);



$query ="select * from users where username='$_POST[username_login]' and password='$password' and status='active'";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);


if($result->num_rows == 1) {
		while($row = $result->fetch_array()) {
		$_SESSION[user_id]=$row[user_id];
		$_SESSION[login]='success';
		$_SESSION[username]=$_POST[username_login];
		//create xml to store username in xml file.. so that can be used for flash get mango game.
		include('create_xml.php');
		if($row[role]=='developer')
		{
		$_SESSION[role]="developer";
		}else{
		$_SESSION[role]="user";
		}
		header("Location: index.php?login=success&#page_four");
		}
}else
{
header("Location: index.php?error=true");
}		
		
		
?>